/**
 *	\file AKStateMaintainer.h
 *  
 *  \section desc_sec Description
 *  Description
 *  
 *  \if copyright
 *  	Copyright 2008 Ben Chen. All rights reserved.
 *  \endif
 *  
 *  \section hist_sec Change History:
 *  	-	1/13/08		BC		Created this file
 *  
 *  <hr>
 *  \addtogroup AnimalKingdom
 *  @{
 */

#import "AKPlugIn.h"

@protocol AKStateMaintainer <AKPlugIn, NSCoding>

@property (readonly, copy) NSArray* eliminatedPieces;	///< Pieces been eliminated during the last turn. NSArray of AKPieces.
@property (readonly, copy) NSArray* createdPieces;		///< Pieces been created during the last turn. NSArray of AKPieces.
@property (readonly, copy) NSArray* movedPieces;		///< Pieces been moved during the last turn. NSArray of AKMoves.
@property (readonly, copy) NSArray* winners;			///< Winners of the game. If the game goes into a draw, all the player should be considered as winners. Nil if no winner emerges yet.

@property (readonly)	AKSideIndex nextPlayerSide;		///< (Archived) The side of the next player. NSNotFound if no next player (e.g. someone wins already).
@property (readonly, copy) NSDictionary* allPieces;		///< (Archived) All pieces that are currently on board. AKPieces are retrieved by the key generated using index.

/**
 *  Go back to initial state.
 */
- (void)backToInitialState;

/**
 *  Perform a move.
 *  \param[in] newMove A new move.
 *  \return YES if the move has been made, otherwise NO meaning the move is not permitted.
 */
- (BOOL)performMove:(AKMove)newMove;

/**
 *  Get cells that the given existing piece can move to.
 *  \param[in] cell The info about the given piece.
 *  \return Array of AKCellIndex wrapped in NSNumber; nil if no reachable cells for the piece.
 */
- (NSArray*)reachableCellsForPiece:(AKPiece)piece; 

/**
 *  Get the type of pieces of the current side that can be created and placed at the given cell.
 *  e.g. In the game of Tic-Tac-Toe, every new move is made by creating a new piece at an empty cell.
 *  \param[in] cell The index of the given cell.
 *  \return Array of AKPieceIndex wrapped in NSNumber; nil if no new pieces.
 */
- (NSArray*)newPiecesAtCell:(AKCellIndex)cell;

/**
 *	Return the piece that is standing in the specified cell and can be moved.
 *	\return AKPiece to represent the piece; AKZeroPiece if no such piece is found.
 */
- (AKPiece)moveablePieceAtCell:(AKCellIndex)cell;

@end

/** @} */

